package com.bourne.enums;

import lombok.Getter;

/**
 * 枚举类，统一状态码信息
 * @author bourne
 * @PROJECT_NAME:
 * @DATE: 2021/3/22 20:00
 * @Description
 */
public enum BizCodeEnum {

    /**
     * 通用操作码
     */
    REQUEST_SUCCESS(0, "成功"),
    REQUEST_FAIL(-1, "失败"),
    DATA_EXISTS(-2, "数据已存在"),
    OPS_REPEAT(100001,"重复操作"),
    NO_PERMISSION(100002, "无权限"),
    /**
     * 系统错误
     */
    JWT_CHECK_FAIL(120001, "JWT解析异常"),
    METHOD_ARGUMENT_NOT_VALID(120002, "方法或参数校验失败"),
    REQUEST_ARGS_NOT_VALID(120003, "请求参数验证失败"),
    REQUEST_ROUTE_NOT_FOUND(120004, "路径不存在，请检查路径是否正确"),
    DATE_REPEAT_COMMIT(120004, "数据重复，请检查信息"),
    SYSTEM_ERROR(120005, "业务请求失败，请稍后再试"),
    METHOD_NOT_SUPPORTED(120006, "请求方式错误"),
    CREATE_DB_DO_FAIL(120007, "自动生成数据库-实体类文件失败"),
    REDIS_CONNECTION_FAIL(120008, "redis连接失败或关闭redis的相关配置"),
    /**
     * 文件
     */
    FILE_UPLOAD_USER_IMG_FAIL(130001, "用户头像文件上传失败"),

    /**
     * 流控操作
     */
    CONTROL_FLOW(140001,"限流控制"),
    CONTROL_DEGRADE(140002,"降级控制"),
    CONTROL_AUTH(140003,"认证控制"),
    CONTROL_HOT(140004,"热点控制"),
    CONTROL_SYSTEM(140005,"规则控制"),

    /**
     *验证码
     */
    CODE_TO_ERROR(150001,"接收号码不合规"),
    CODE_LIMITED(150002,"验证码发送过快"),
    CODE_ERROR(150003,"验证码错误"),
    CODE_CAPTCHA_ERROR(150004,"图形验证码错误"),

    /**
     * MQ错误
     */
    DELAY_TIME_LEVEL_ILLEGAL(160001,"延迟等级不合法"),
    QUEUE_NUM_ILLEGAL(160002, "指定的队列不合法"),
    MQ_CONFIG_FAIL(160003, "配置错误"),
    MESSAGE_SEND_FAIL(160004, "消息发送失败"),

    /**
     * 建筑物服务
     */
    VILLAGE_CREATE_FAIL(170001, "新增小区信息失败"),
    STORIED_HOUSE_CREATE_FAIL(170002, "新增楼宇信息失败"),
    VILLAGE_STORIED_CHECK_FAIL(170003, "小区与楼宇信息错误"),
    STORIED_FLOOR_NOT_EXIST(170004, "楼层不存在"),
    STORIED_UNIT_NOT_EXIST(170005, "单元不存在"),
    BUILDING_SERVICE_REQUEST_FAIL(170006, "社区服务请求失败"),

    /**
     * 用户
     */
    ACCOUNT_REPEAT(180001,"账号已经存在"),
    ACCOUNT_UNREGISTER(180002,"账号不存在"),
    ACCOUNT_PWD_ERROR(180003,"账号或者密码错误"),
    ACCOUNT_UN_LOGIN(180004, "账号未登录"),
    ACCOUNT_UN_KNOW_IP(180005, "系统监测到您的账号存在异常，为保障您的账号安全，请重新登录"),
    USER_HOUSE_BINDING_EXIST(180006,"房间已存在绑定关系"),
    USER_HOUSE_BINDING_FAIL(180007, "用户绑定房间失败"),
    ACCOUNT_INVALID(180008,"账号不存在"),
    ACCOUNT_EXPIRE(180009,"账号登录信息已过期"),
    ACCOUNT_RSA_ERROR(180010, "生成RSA密钥对失败"),
    ACCOUNT_BUILD_ERROR_FOR_RSA(180011, "构建用户信息失败"),
    ACCOUNT_TOKEN_BUILD_ERROR(180012, "生成token失败"),
    ACCOUNT_RE_PASS_WORD_ERROR(180013, "两次输入的密码不正确"),
    ACCOUNT_PHONE_ERROR(180014, "手机号格式不正确"),


    /**
     * 字典模块
     */
    DICT_NOT_FOUND_FOR_DB(200001, "未查询到字典信息"),
    DICT_FIELD_VALUE_IS_NULL(200002, "字典值不能为空"),
    DICT_UPDATE_FAIL(200003, "字典值更新失败"),

    /**
     * 地址模块
     */
    ADDRESS_DEL_FAIL(190001, "删除收货地址失败"),
    ADDRESS_NO_EXIT(190002, "地址不存在");



    @Getter
    private int code;

    @Getter
    private String message;


    BizCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

}
